package com.sloera.regext;

import java.security.GeneralSecurityException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author sloera
 * @create 2020/7/28
 */
public class regexTemp {
    public static void main(String[] args) throws GeneralSecurityException {
        regexFind();
    }

    /*
     * @Description 利用正则查找字符串
     * @param :
     * @Return void
     * @Author SloeraN
     * @Date 2020/7/29 22:49
     */
    public static void regexFind() {
        String s = "the quick brown fox jumps over the lazy dog.";
        Pattern p = Pattern.compile("\\wo\\w");
        Matcher m = p.matcher(s);
        //搜索能匹配上\wo\w规则的子串
        while (m.find()) {
            m.group(1);
            String sub = s.substring(m.start(), m.end());
            System.out.println(sub);
        }
    }
}
